[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 POP VAR[,VAR...]

 Function
  Pop values (previously pushed onto the stack) into a list of variables.

 Syntax
  POP var[,var]

   var  - A variable of any type in which to retrieve previously
          pushed expression.

 Remarks
  This statement will retrieve one or more expressions of any type from the
  stack into a list of variables.  The values should have been previously
  pushed with PUSH.  PUSH and POP can be used for parameter passing, to
  create 'local' variables, or to reverse the order of arguments.

 Examples
  INTEGER i, tc
  STRING  s
  LET tc = TOKCOUNT()
  WHILE (TOKCOUNT() > 0) PUSH GETTOKEN() ' push them in order
  FOR i = 1 TO tc
   POP s                                 ' pop them in reverse
   PRINTLN s
  NEXT

  INTEGER i
  FOR i = 1 TO 10
   PRINT i," - "
   GOSUB sub
  NEXT
  END
  :sub
  PUSH i                                 ' temporarily save i
  LET i = i*i
  PRINTLN i
  POP i                                  ' restore saved i
  RETURN

  INTEGER v
  PRINT "A cube with dimensions 2X3X4"
  PUSH 2,3,4                             ' pass pushed parameters
  GOSUB vol
  POP v                                  ' pop result
  PRINTLN "has volume ",v
  END
  :vol
  INTEGER w,h,d
  POP d,h,w                              ' pop passed parameter
  PUSH w*h*d                             ' push result
  RETURN

See Also: PUSH
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson